
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@taglib uri="http://java.sun.com/jstl/core_rt" prefix="c" %>
<%@page import="test.Contact,java.util.List,java.util.ArrayList" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Core Tags</title>
    </head>
    <body>
        <%
            List<Contact> list = new ArrayList<Contact>();
            list.add(new Contact("Akram", "Tavarakere", "Bangalore"));
            list.add(new Contact("Ajmal", "Bommanahalli", "Bangalore"));
            list.add(new Contact("Anwar", "Gremes Road", "Chennai"));
            list.add(new Contact("Haris", "Car Street", "Madurai"));
            list.add(new Contact("Jabbar", "Thillai Nagar", "Tiruchirappalli"));
        %>
        
        <%--
        <c:out value='<%=request.getParameter("val")%>'/>
        <c:set var="cont" value="<%=%>"/>
        <c:out value="${param['val']}"/>
        <c:set var="x" value="100"/>
        Name:<c:out value="${cont.name}"/><br>
        Address:<c:out value="${cont.address1}"/><br>
        City:<c:out value="${cont.city}"/><br>
        
        
        <c:set var="mk" value="${param['mark']}"/>
        <c:if test="${mk<40}">
            <p align="left" style="color:red;">Fail</p>
        </c:if>
        <c:if test="${mk>=40}">
            <p align="left" style="color:green;">Pass</p>
        </c:if>
        
        
       
    `   <c:set var="mk" value="${param['mark']}"/>
        <c:choose>
            <c:when test="${mk>=0 and mk<40}">
                Fail
            </c:when>
            <c:when test="${mk>=40 and mk<60}">
                Second Class
            </c:when>
            <c:when test="${mk>=60 and mk<80}">
                First Class
            </c:when>
            <c:when test="${mk>=80 and mk<=100}">
                Distinction
            </c:when>
            <c:otherwise>
                Invalid mark
            </c:otherwise>
        </c:choose>
       --%>
        
        <table border="1">
            <tr>
                <th>S.No.</th><th>Name</th><th>Address</th><th>City</th>
            </tr>
            <c:forEach var="contact" items="<%=list%>" varStatus="vs" step="1">
                <tr>
                    <td>${vs.count}</td>
                    <td>${contact.name}</td>
                    <td>${contact.address1}</td>
                    <td>${contact.city}</td>
                </tr>
            </c:forEach>
        </table>
    </body>
</html>
